package com.qf.controller;

import com.qf.pojo.repVo.BaseResp;
import com.qf.service.ShopCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/shop")
public class ShopCardController {

    @Autowired
    ShopCardService shopCardService;
    /**
     * 添加购物车
     */
    @RequestMapping("/addShopCard")
    public BaseResp addShopCard(@RequestBody Map map, HttpServletRequest request){
        return shopCardService.addShopCard(map,request);
    }

    /**
     * 查询购物车中的商品
     */
    @RequestMapping("/findShopCardByToken")
    public BaseResp findShopCardByToken(HttpServletRequest request){
        return shopCardService.findShopCardByToken(request);
    }

    /**
     * 移除购物车
     */
    @RequestMapping("/delShop")
    public BaseResp delShop(@RequestBody Map map,HttpServletRequest request){
        return shopCardService.delShop(map,request);
    }
}
